package com.relytosoft.mizar.media.display.api.pojo.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.relytosoft.mizar.media.display.api.pojo.query.ChannelPlayDetailQuery;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

import java.io.Serializable;

/**
 * 通道码流数据传输类
 *
 * @author hj
 * @version 1.0
 * @date 2022/4/24 15:26
 * @ClassName ChannelRtspStreamDto
 */
public class ChannelRtspStreamDto implements Serializable {

    private static final long serialVersionUID = -2957811901939151000L;

    /**
     * 主码流rtsp_url
     */
    @ApiModelProperty("主码流rtsp_url")
    @TableField("MAIN_STREAM_RTSP_URL")
    private String mainStreamRtspUrl;

    /**
     * 子码流rtsp_url
     */
    @ApiModelProperty("子码流")
    @TableField("SUB_STREAM_RTSP_URL")
    private String subStreamRtspUrl;

    /**
     * 通道id
     */
    @ApiModelProperty("通道ID")
    @TableField("CHANNEL_ID")
    private Integer channelId;

    @ApiModelProperty("视图顺序索引")
    @TableField("VIEW_INDEX")
    private Integer viewIndex;

    @ApiModelProperty("三方通道id")
    @TableField("PLATFORM_CHANNEL_CODE")
    private String platformChannelCode;

    public Integer getViewIndex() {
        return viewIndex;
    }

    public void setViewIndex(Integer viewIndex) {
        this.viewIndex = viewIndex;
    }

    public String getPlatformChannelCode() {
        return platformChannelCode;
    }

    public void setPlatformChannelCode(String platformChannelCode) {
        this.platformChannelCode = platformChannelCode;
    }

    public ChannelRtspStreamDto() {
    }

    public ChannelRtspStreamDto(Integer channelId) {
        this.channelId = channelId;
    }

    public String getMainStreamRtspUrl() {
        return mainStreamRtspUrl;
    }

    public void setMainStreamRtspUrl(String mainStreamRtspUrl) {
        this.mainStreamRtspUrl = mainStreamRtspUrl;
    }

    public String getSubStreamRtspUrl() {
        return subStreamRtspUrl;
    }

    public void setSubStreamRtspUrl(String subStreamRtspUrl) {
        this.subStreamRtspUrl = subStreamRtspUrl;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    @Override
    public String toString() {
        return "ChannelRtspStreamDto{" +
                "mainStreamRtspUrl='" + mainStreamRtspUrl + '\'' +
                ", subStreamRtspUrl='" + subStreamRtspUrl + '\'' +
                ", channelId=" + channelId +
                '}';
    }

    public ChannelPlayDetailQuery buildChannelPlayDetailQuery(boolean isMain){
        ChannelPlayDetailQuery query = new ChannelPlayDetailQuery();
        query.setChannelId(this.getChannelId());
        if(isMain){
            query.setStreamRtspUrl(this.getMainStreamRtspUrl());
        }else {
            query.setStreamRtspUrl(this.getSubStreamRtspUrl());
        }
        return query;
    }

    public ChannelRtspStreamDto(String mainStreamRtspUrl, String subStreamRtspUrl, Integer channelId) {
        this.mainStreamRtspUrl = mainStreamRtspUrl;
        this.subStreamRtspUrl = subStreamRtspUrl;
        this.channelId = channelId;
    }
}
